import request from '@/utils/request'

// 登录
export function userLogin(name,password) {
    return request({
        url: '/login',
        method: 'post',
        headers: {
            isToken: false
          },
        data: {'name':name,'password':password}
    })
}

//注册
export function userRegister(name,nickname,email,password) {
    return request({
        url: '/user/register',
        method: 'post',
        headers: {
            isToken :false
        },
        data: {"name":name,"nickname":nickname,"email":email,"password":password}
    })
}

//退出登录
export function logout() {
    return request({
        url: '/logout',
        method: 'post'
    })
}

//获取用户信息
export function getUserInfo() {   //原来传递了用户id
    return request ({
        url: '/user/userInfo',
        method: 'get'  
    })
}

//用户资料更新
export function savaUserInfo(userinfo) {
    return request({
        url: '/user/userInfo',
        method: 'put',
        data: userinfo
    })
}